This repository was archived by the owner on May 27, 2026. It is now read-only.
Fix regex syntax when pattern has double quote or escape on py and java#1361
Open
fishcakez wants to merge 1 commit into
Open
Fix regex syntax when pattern has double quote or escape on py and java#1361fishcakez wants to merge 1 commit into
fishcakez wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When trying to use regex patterns with quotes or escapes in there are syntax issues for py and java.
For py, the generated code for regex containing a
"is not be escaped and fail at runtime withSyntaxError. Therefore reuse the pythonrusage handling so that Python converts to string to escape correctly. The test added will fail to compile without the fix:For java, the generated code for regex containing
\is not escaped and failed at compile. There is a commented out ReplaceAll for java to escape it. Removing the commented out line passes a simple text. Looking through the code history this commented out line has been there since original PR. The test added will fail to compile without the fix: